cargo.git
8 years agouse shell helpers to condense output
Alex Burka [Wed, 12 Jul 2017 19:31:30 +0000 (15:31 -0400)]
use shell helpers to condense output

8 years agoonly print PATH warning once
Alex Burka [Wed, 12 Jul 2017 18:57:47 +0000 (14:57 -0400)]
only print PATH warning once

8 years agodon't print summary of single crate install
Alex Burka [Sat, 24 Jun 2017 03:27:46 +0000 (23:27 -0400)]
don't print summary of single crate install

8 years agosupport installing multiple crates
Alex Burka [Fri, 23 Jun 2017 23:30:46 +0000 (19:30 -0400)]
support installing multiple crates

8 years agomake SourceConfigMap cloneable
Alex Burka [Fri, 23 Jun 2017 23:30:25 +0000 (19:30 -0400)]
make SourceConfigMap cloneable

8 years agoupdate test
Alex Burka [Fri, 23 Jun 2017 23:30:05 +0000 (19:30 -0400)]
update test

8 years agoold commit adding some support for multi-install
Paul Woolcock [Thu, 21 Apr 2016 16:23:33 +0000 (12:23 -0400)]
old commit adding some support for multi-install

8 years agoAuto merge of #4201 - alexcrichton:more-human, r=matklad
bors [Wed, 21 Jun 2017 18:26:14 +0000 (18:26 +0000)]
Auto merge of #4201 - alexcrichton:more-human, r=matklad

Flag crate registry errors as "human"

They often contain useful information!

Closes #4200

8 years agoAuto merge of #4202 - dethoter:issue-4199, r=alexcrichton
bors [Wed, 21 Jun 2017 17:49:38 +0000 (17:49 +0000)]
Auto merge of #4202 - dethoter:issue-4199, r=alexcrichton

Fix an incorrect merge of credentials. Add a new test for that.

Fix for #4199.

8 years agoFix an incorrect merge of credentials. Add a new test for that.
Evgen Druzhynin [Wed, 21 Jun 2017 16:48:40 +0000 (19:48 +0300)]
Fix an incorrect merge of credentials. Add a new test for that.

8 years agoFlag crate registry errors as "human"
Alex Crichton [Wed, 21 Jun 2017 15:11:08 +0000 (08:11 -0700)]
Flag crate registry errors as "human"

They often contain useful information!

Closes #4200

8 years agoAuto merge of #4196 - gilescope:multiline_assert, r=alexcrichton
bors [Wed, 21 Jun 2017 14:04:55 +0000 (14:04 +0000)]
Auto merge of #4196 - gilescope:multiline_assert, r=alexcrichton

Multiline assert

Found a second location where multiline assert_eq failure breaks a test.
This is an extention of #4181.

8 years agoAuto merge of #4180 - pnkfelix:issue-4135, r=alexcrichton
bors [Wed, 21 Jun 2017 12:11:25 +0000 (12:11 +0000)]
Auto merge of #4180 - pnkfelix:issue-4135, r=alexcrichton

Issue 4135: include = [...] should override git file list

Fix #4135: if theres `include = [...]`, then do not prepopulate file list via git.

8 years agoMerge branch 'master' into multiline_assert
Squirrel [Wed, 21 Jun 2017 10:15:17 +0000 (11:15 +0100)]
Merge branch 'master' into multiline_assert

8 years agoRegression test for issue #4135.
Felix S. Klock II [Fri, 16 Jun 2017 15:54:59 +0000 (17:54 +0200)]
Regression test for issue #4135.

8 years agoPrep for asser_eq failure msg format change.
Giles Cope [Tue, 20 Jun 2017 22:14:15 +0000 (23:14 +0100)]
Prep for asser_eq failure msg format change.

8 years agoAuto merge of #4190 - alexcrichton:wincosole-fix, r=alexcrichton
bors [Mon, 19 Jun 2017 17:43:46 +0000 (17:43 +0000)]
Auto merge of #4190 - alexcrichton:wincosole-fix, r=alexcrichton

Update wincolor

Helps mitigate #4189

8 years agoUpdate wincolor
Alex Crichton [Mon, 19 Jun 2017 17:42:58 +0000 (10:42 -0700)]
Update wincolor

Helps mitigate #4189

8 years agoAuto merge of #4181 - gilescope:patch-1, r=alexcrichton
bors [Mon, 19 Jun 2017 14:09:30 +0000 (14:09 +0000)]
Auto merge of #4181 - gilescope:patch-1, r=alexcrichton

Make test less brittle prior to assert_eq failure message format change

PR required for rust-lang/rust#42541 to make assert_eq error message be multi-line. Before implementing this we need to make the current test less brittle.
Not 100% clear on if I need the final [...] or not.

8 years agoFixing test failure
Squirrel [Sun, 18 Jun 2017 21:03:06 +0000 (22:03 +0100)]
Fixing test failure

8 years agoAuto merge of #4182 - matklad:simplify, r=alexcrichton
bors [Sat, 17 Jun 2017 19:14:50 +0000 (19:14 +0000)]
Auto merge of #4182 - matklad:simplify, r=alexcrichton

Simplify inferred binary names

Fix for https://github.com/rust-lang/rust/issues/42365, which probably breaks other stuff :(

8 years agoAuto merge of #4185 - ids1024:typo, r=Mark-Simulacrum
bors [Sat, 17 Jun 2017 18:22:04 +0000 (18:22 +0000)]
Auto merge of #4185 - ids1024:typo, r=Mark-Simulacrum

Fix typo in comment

8 years agoFix typo in comment
Ian Douglas Scott [Sat, 17 Jun 2017 17:35:20 +0000 (10:35 -0700)]
Fix typo in comment

8 years agoFix test on windows
Aleksey Kladov [Sat, 17 Jun 2017 15:43:05 +0000 (18:43 +0300)]
Fix test on windows

Backslashes here are escaped (\\), so [/] does not really help :(

8 years agoAuto merge of #4178 - nrc:shell, r=alexcrichton
bors [Sat, 17 Jun 2017 06:10:23 +0000 (06:10 +0000)]
Auto merge of #4178 - nrc:shell, r=alexcrichton

Support having a generic writer instead of a termcolor StandardStream

This is requied by the RLS (and presumably any other client who wants to use Cargo as a lib and redirect output)

r? @alexcrichton

8 years agoSupport having a generic writer instead of a termcolor StandardStream
Nick Cameron [Fri, 16 Jun 2017 02:57:27 +0000 (14:57 +1200)]
Support having a generic writer instead of a termcolor StandardStream

This is requied by the RLS (and presumably any other client who wants to use Cargo as a lib and redirect output)

8 years agoDon't search bins in src if there's a library
Aleksey Kladov [Fri, 16 Jun 2017 20:38:54 +0000 (23:38 +0300)]
Don't search bins in src if there's a library

Ideally we want not to search for binaries there in any case, but that's
probably not gonna happen due to backwards comparability.

8 years agoSimplify inferred binary names
Aleksey Kladov [Fri, 16 Jun 2017 19:41:27 +0000 (22:41 +0300)]
Simplify inferred binary names

8 years agoMake test less brittle prior to assert_eq failure message format change
Squirrel [Fri, 16 Jun 2017 18:20:41 +0000 (19:20 +0100)]
Make test less brittle prior to assert_eq failure message format change

PR #42541 on Rust is to make assert_eq error message be multi-line. Before implementing this we need to make the current test less brittle.

8 years agoFix #4135: if theres `include = [...]`, then dont prepopulate filelist via git
Felix S. Klock II [Fri, 16 Jun 2017 15:54:44 +0000 (17:54 +0200)]
Fix #4135: if theres `include = [...]`, then dont prepopulate filelist via git

8 years agoFactor search for sibling Cargo.toml and .git folder into separate subroutine.
Felix S. Klock II [Thu, 8 Jun 2017 10:39:28 +0000 (12:39 +0200)]
Factor search for sibling Cargo.toml and .git folder into separate subroutine.

8 years agoassert_eq failure message now multi-line related to rust pull request 42541.
Giles Cope [Fri, 16 Jun 2017 07:40:05 +0000 (08:40 +0100)]
assert_eq failure message now multi-line related to rust pull request 42541.

8 years agoAuto merge of #4125 - alexcrichton:rerun-if-env-changed, r=matklad
bors [Thu, 15 Jun 2017 17:52:42 +0000 (17:52 +0000)]
Auto merge of #4125 - alexcrichton:rerun-if-env-changed, r=matklad

Implement `cargo:rerun-if-env-changed=FOO`

This commit implements a new method of rerunning a build script if an
environment variable changes. Environment variables are one of the primary
methods of giving inputs to a build script today, and this'll help situations
where if you change an env var you don't have to remember to clean out an old
build directory to ensure fresh results.

Closes #2776

8 years agoAuto merge of #4176 - alexcrichton:atty, r=matklad
bors [Thu, 15 Jun 2017 16:17:29 +0000 (16:17 +0000)]
Auto merge of #4176 - alexcrichton:atty, r=matklad

Use the `atty` crate for TTY detection

This is more robust in the face of msys terminals and otherwise helps share more
dependencies!

Closes #4166

8 years agoUse the `atty` crate for TTY detection
Alex Crichton [Thu, 15 Jun 2017 15:08:35 +0000 (08:08 -0700)]
Use the `atty` crate for TTY detection

This is more robust in the face of msys terminals and otherwise helps share more
dependencies!

Closes #4166

8 years agoImplement `cargo:rerun-if-env-changed=FOO`
Alex Crichton [Mon, 5 Jun 2017 14:52:31 +0000 (07:52 -0700)]
Implement `cargo:rerun-if-env-changed=FOO`

This commit implements a new method of rerunning a build script if an
environment variable changes. Environment variables are one of the primary
methods of giving inputs to a build script today, and this'll help situations
where if you change an env var you don't have to remember to clean out an old
build directory to ensure fresh results.

Closes #2776

8 years agoAuto merge of #4167 - alexcrichton:keep-metadata, r=matklad
bors [Wed, 14 Jun 2017 19:40:34 +0000 (19:40 +0000)]
Auto merge of #4167 - alexcrichton:keep-metadata, r=matklad

Preserve `package.metadata` when packaging

Now that we use Serde this is actually trivial to implement!

Closes #4142

8 years agoAuto merge of #4168 - alexcrichton:more-metadata, r=alexcrichton
bors [Wed, 14 Jun 2017 18:19:17 +0000 (18:19 +0000)]
Auto merge of #4168 - alexcrichton:more-metadata, r=alexcrichton

Hash `Kind` in metadata for crates

This fixes what is now a bug in Cargo discovered when attempting to land
rust-lang/rust#42495 where Cargo will compile both host and target artifacts
with the same `-C metadata` flag. This means that the compile can load two
crates with the same SVH that are supposed to be distinct, which causes weird
bugs with crate loading and whatnot.

This commit throws in the `Kind` into the metadata calculation to resolve this
to ensure that host/target artifacts always have a different `-C metadata`

8 years agoHash `Kind` in metadata for crates
Alex Crichton [Wed, 14 Jun 2017 18:16:24 +0000 (11:16 -0700)]
Hash `Kind` in metadata for crates

This fixes what is now a bug in Cargo discovered when attempting to land
rust-lang/rust#42495 where Cargo will compile both host and target artifacts
with the same `-C metadata` flag. This means that the compile can load two
crates with the same SVH that are supposed to be distinct, which causes weird
bugs with crate loading and whatnot.

This commit throws in the `Kind` into the metadata calculation to resolve this
to ensure that host/target artifacts always have a different `-C metadata`

8 years agoPreserve `package.metadata` when packaging
Alex Crichton [Wed, 14 Jun 2017 14:56:40 +0000 (07:56 -0700)]
Preserve `package.metadata` when packaging

Now that we use Serde this is actually trivial to implement!

Closes #4142

8 years agoAuto merge of #4162 - alexcrichton:termcolor, r=matklad
bors [Wed, 14 Jun 2017 09:57:12 +0000 (09:57 +0000)]
Auto merge of #4162 - alexcrichton:termcolor, r=matklad

Migrate from the `term` crate to `termcolor`

The API of `termcolor` fits what the system gives us much more nicely and should
be well battle-tested from ripgrep. Additionally we don't really need huge
terminfo parsers, that wasn't every really the intention of the color support
here.

8 years agoAuto merge of #4155 - ketralnis:fossil, r=alexcrichton
bors [Wed, 14 Jun 2017 03:33:46 +0000 (03:33 +0000)]
Auto merge of #4155 - ketralnis:fossil, r=alexcrichton

Add fossil VCS support to `cargo new`

Fossil is a simple, high-reliability, distributed software configuration management system <https://www.fossil-scm.org/>

I mostly followed https://github.com/rust-lang/cargo/pull/3842 as a template. Like that one, this only adds support for `cargo new`, not for pulling down fossil-hosted dependencies

A problem that i didn't tackle but I'd be willing to is a little more more `trait`ifying of the VCSs. I would need some guidance on that since it looks like git has some more thorough support than e.g. hg does but it looks pretty doable

8 years agoAuto merge of #4159 - matklad:arch, r=alexcrichton
bors [Wed, 14 Jun 2017 03:01:33 +0000 (03:01 +0000)]
Auto merge of #4159 - matklad:arch, r=alexcrichton

Blurb about Cargo inner workings

Hi!

At today's dev tools meetings we've discussed how we can foster contributions to rust dev tools, and I've complained that some tools are difficult to contribute to because it's difficult to learn how they work because there are no docs, and some other people complained that Cargo is difficult to contribute to because it is rather complex. And, as a member of Cargo team, I thought that I am probably responsible for fixing that :)

So, here's my take at making it easier to dive in into Cargo! I've written a small birds eye overview of the current architecture of Cargo (more like a list of things to look at while reading the code actually :)

In general, I am skeptical about documenting internals of binaries (docs will become obsolete, and very fast), but such a high level picture should be pretty robust (I deliberately avoided linking to the actual source code), and so pretty low-effort to maintain. We do something similar for IntelliJ Rust: https://github.com/intellij-rust/intellij-rust/blob/master/ARCHITECTURE.md as well.

r? @alexcrichton

8 years agoAuto merge of #4158 - stepancheg:hg-ignore, r=alexcrichton
bors [Wed, 14 Jun 2017 02:41:12 +0000 (02:41 +0000)]
Auto merge of #4158 - stepancheg:hg-ignore, r=alexcrichton

Generate .hgignore with syntax:glob

Fixes #4005

8 years agoMigrate from the `term` crate to `termcolor`
Alex Crichton [Thu, 8 Jun 2017 22:09:04 +0000 (15:09 -0700)]
Migrate from the `term` crate to `termcolor`

The API of `termcolor` fits what the system gives us much more nicely and should
be well battle-tested from ripgrep. Additionally we don't really need huge
terminfo parsers, that wasn't every really the intention of the color support
here.

8 years agoAuto merge of #4149 - ordian:master, r=alexcrichton
bors [Tue, 13 Jun 2017 19:53:41 +0000 (19:53 +0000)]
Auto merge of #4149 - ordian:master, r=alexcrichton

Drop rustc-serialize dependency

Fixes #3944.

8 years agoAuto merge of #3978 - dethoter:separated-credentials, r=alexcrichton
bors [Tue, 13 Jun 2017 19:18:49 +0000 (19:18 +0000)]
Auto merge of #3978 - dethoter:separated-credentials, r=alexcrichton

Move API token into the separate file.

Fix of #3748. BTW, it's not clear what to do with old config.
Should I add a check for old config and try to remove [repository.token] field from it every time user add a new token?
Or should I just prefer to use a token field from a new config over the old one?

8 years agoFix typos and reword slightly
Aleksey Kladov [Tue, 13 Jun 2017 18:40:58 +0000 (21:40 +0300)]
Fix typos and reword slightly

8 years agoAuto merge of #4163 - alexcrichton:update, r=alexcrichton
bors [Tue, 13 Jun 2017 17:40:00 +0000 (17:40 +0000)]
Auto merge of #4163 - alexcrichton:update, r=alexcrichton

Update dependencies

Brings in a few fixes for Windows-related dependencies

8 years agoUpdate dependencies
Alex Crichton [Tue, 13 Jun 2017 17:39:01 +0000 (10:39 -0700)]
Update dependencies

Brings in a few fixes for Windows-related dependencies

8 years agoBlurb about Cargo inner workings
Aleksey Kladov [Mon, 12 Jun 2017 22:24:50 +0000 (01:24 +0300)]
Blurb about Cargo inner workings

8 years agoGenerate .hgignore with syntax:glob
Stepan Koltsov [Sun, 11 Jun 2017 04:23:46 +0000 (07:23 +0300)]
Generate .hgignore with syntax:glob

Fixes #4005

8 years agoAdd fossil VCS support to `cargo new`
David King [Sat, 10 Jun 2017 00:51:56 +0000 (17:51 -0700)]
Add fossil VCS support to `cargo new`

Fossil is a simple, high-reliability, distributed software configuration
management system <https://www.fossil-scm.org/>

8 years agoUpdate a credentials file format. Implement tests for login command.
Evgen Druzhynin [Fri, 9 Jun 2017 10:07:06 +0000 (13:07 +0300)]
Update a credentials file format. Implement tests for login command.

8 years agoRevert "Credentials for multiple hosts."
Evgen Druzhynin [Fri, 9 Jun 2017 10:14:19 +0000 (13:14 +0300)]
Revert "Credentials for multiple hosts."

This reverts commit 29960d2528e65208dacef21252556a2415f87ad7.

8 years agoDrop rustc-serialize dependency
Andronik Ordian [Thu, 8 Jun 2017 20:08:59 +0000 (23:08 +0300)]
Drop rustc-serialize dependency

8 years agoAuto merge of #4146 - alexcrichton:bump, r=alexcrichton
bors [Thu, 8 Jun 2017 16:19:04 +0000 (16:19 +0000)]
Auto merge of #4146 - alexcrichton:bump, r=alexcrichton

Bump to 0.21.0

We're working on the next version now!

8 years agoBump to 0.21.0
Alex Crichton [Thu, 8 Jun 2017 16:08:01 +0000 (09:08 -0700)]
Bump to 0.21.0

We're working on the next version now!

8 years agoAuto merge of #4145 - rust-lang:matklad-patch-1, r=alexcrichton
bors [Thu, 8 Jun 2017 14:54:36 +0000 (14:54 +0000)]
Auto merge of #4145 - rust-lang:matklad-patch-1, r=alexcrichton

Fix flaky test

closes #4144.

8 years agoFix flaky test
Aleksey Kladov [Thu, 8 Jun 2017 14:41:31 +0000 (17:41 +0300)]
Fix flaky test

8 years agoAuto merge of #4141 - Keruspe:master, r=alexcrichton
bors [Wed, 7 Jun 2017 19:40:14 +0000 (19:40 +0000)]
Auto merge of #4141 - Keruspe:master, r=alexcrichton

update git2

Fixes build with libressl

8 years agoupdate git2
Marc-Antoine Perennou [Wed, 7 Jun 2017 19:35:27 +0000 (21:35 +0200)]
update git2

Fixes build with libressl

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
8 years agoAuto merge of #4139 - Keruspe:master, r=alexcrichton
bors [Wed, 7 Jun 2017 18:06:32 +0000 (18:06 +0000)]
Auto merge of #4139 - Keruspe:master, r=alexcrichton

Include rustc version in metadata

Followup to #4134
Fixes https://github.com/rust-lang/rust/issues/42483

8 years agoAuto merge of #4137 - tshepang:immutable, r=alexcrichton
bors [Wed, 7 Jun 2017 17:31:32 +0000 (17:31 +0000)]
Auto merge of #4137 - tshepang:immutable, r=alexcrichton

binding does not need to be mutable

8 years agoAuto merge of #4062 - huntiep:master, r=alexcrichton
bors [Wed, 7 Jun 2017 16:37:40 +0000 (16:37 +0000)]
Auto merge of #4062 - huntiep:master, r=alexcrichton

Load local git name/email for cargo init

Fixes #3920

8 years agoInclude rustc version in metadata
Marc-Antoine Perennou [Wed, 7 Jun 2017 15:53:23 +0000 (17:53 +0200)]
Include rustc version in metadata

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
8 years agoAuto merge of #4138 - alexcrichton:fix-tests, r=alexcrichton
bors [Wed, 7 Jun 2017 15:42:07 +0000 (15:42 +0000)]
Auto merge of #4138 - alexcrichton:fix-tests, r=alexcrichton

Fix tests on beta

Had a few usages of `-Z` leak out of the nightly channel.

8 years agoFix tests on beta
Alex Crichton [Wed, 7 Jun 2017 15:37:50 +0000 (08:37 -0700)]
Fix tests on beta

Had a few usages of `-Z` leak out of the nightly channel.

8 years agobinding does not need to be mutable
Tshepang Lekhonkhobe [Wed, 7 Jun 2017 15:23:36 +0000 (17:23 +0200)]
binding does not need to be mutable

8 years agoAdd test for local gitconf
Hunter Praska [Wed, 7 Jun 2017 00:24:00 +0000 (19:24 -0500)]
Add test for local gitconf

8 years agoAuto merge of #4126 - malbarbo:bump-jobserver, r=alexcrichton
bors [Mon, 5 Jun 2017 17:16:58 +0000 (17:16 +0000)]
Auto merge of #4126 - malbarbo:bump-jobserver, r=alexcrichton

Bump jobserver to 0.1.4

8 years agoBump jobserver to 0.1.4
Marco A L Barbosa [Mon, 5 Jun 2017 17:15:40 +0000 (14:15 -0300)]
Bump jobserver to 0.1.4

8 years agoAuto merge of #4118 - alexcrichton:hamt, r=matklad
bors [Mon, 5 Jun 2017 14:49:59 +0000 (14:49 +0000)]
Auto merge of #4118 - alexcrichton:hamt, r=matklad

Optimize a slew of Cargo internals

Cargo has historically had very little optimization applied to it. Despite that it's pretty speedy today but there's always a desire to be faster! I've noticed Cargo being particularly sluggish on projects like Servo and rust-lang/rust, so I started profiling and found quite a few low-hanging fruit!

This PR is a slew of optimizations across Cargo for various things found here and there. The banner optimizations are:

* Resolution with a lock file should be basically a noop in terms of execution time now. An optimization was done to avoid cloning `Context` unless necessary, and that basically means it doesn't get cloned now! As the number 1 source of slowdown in Cargo this is the biggest improvement.
* Lots of pieces in `resolve` are now `Rc<T>` for being more easily cloneable.
* `Summary` now internally contains an `Rc` like `Dependency`, making it much more quickly cloneable.
* `Registry` as a trait no longer returns a `Vec` but rather takes a closure to yield summaries up, removing lots of intermediate arrays.
* We no longer spawn a thread for all units of "fresh work", only when we're about to spawn a process.

Almost everything here was guided through profiling `./x.py build` on rust-lang/rust or `cargo build -p log` on Servo. Both of these stress "noop resolution" and the former also stresses noop builds.

Runs of `./x.py build` dropped from 4 to 2 seconds (with lots of low-hanging fruit still remaining in Cargo itself) and `cargo build -p log` dropped from 1.5s to 0.3s. Massif graphs showing Cargo's memory usage also show that the peak memory usage of Cargo in a noop build of Servo dropped from 300MB to 30MB during resolution.

I'm hoping that none of these optimizations makes the code less readable and/or understandable. There are no algorithmic improvements in this PR other than those transitively picked up by making clones cheaper and/or allocating less.

8 years agoFix tests
Alex Crichton [Mon, 5 Jun 2017 14:44:16 +0000 (07:44 -0700)]
Fix tests

8 years agoRemove the RefCell from `PackageRegistry`
Alex Crichton [Mon, 5 Jun 2017 14:22:38 +0000 (07:22 -0700)]
Remove the RefCell from `PackageRegistry`

Some choice refactoring makes it no longer necessary!

8 years agoComment about `Clone` on Context
Alex Crichton [Sat, 3 Jun 2017 18:11:22 +0000 (11:11 -0700)]
Comment about `Clone` on Context

8 years agoType alias `activations` to consolidate definition
Alex Crichton [Sat, 3 Jun 2017 18:03:12 +0000 (11:03 -0700)]
Type alias `activations` to consolidate definition

Avoids duplicating tons of maps!

8 years agoRemove stray Registry impls
Alex Crichton [Sat, 3 Jun 2017 18:02:14 +0000 (11:02 -0700)]
Remove stray Registry impls

They're basically barely used now anyway.

8 years agoAvoid stack overflow when dropping RcList
Alex Crichton [Sat, 3 Jun 2017 00:25:33 +0000 (17:25 -0700)]
Avoid stack overflow when dropping RcList

Turn recursion into a loop

8 years agoRemove `Clone` for a struct we don't want cloned
Alex Crichton [Sat, 3 Jun 2017 00:18:06 +0000 (17:18 -0700)]
Remove `Clone` for a struct we don't want cloned

It's super expensive to clone a `Resolve` and the resolution implementation no
longer needs to do so, let's remove the impl.

8 years agoReorganize `PackageRegistry::query` a bit
Alex Crichton [Sat, 3 Jun 2017 00:17:24 +0000 (17:17 -0700)]
Reorganize `PackageRegistry::query` a bit

Less branches and more intuitive flow.

8 years agoRemove DependencyInner as a public API
Alex Crichton [Sat, 3 Jun 2017 00:13:52 +0000 (17:13 -0700)]
Remove DependencyInner as a public API

No need for it to be exposed any more, let's just use `Rc::make_mut`
judiciously.

8 years agoCache `Context::target_filenames`
Alex Crichton [Fri, 2 Jun 2017 16:31:44 +0000 (09:31 -0700)]
Cache `Context::target_filenames`

Relatively expensive to calculate, never changes, easy to add a cache!

8 years agoDon't spawn threads for fresh work
Alex Crichton [Fri, 2 Jun 2017 16:15:11 +0000 (09:15 -0700)]
Don't spawn threads for fresh work

On "fresh" builds this ends up just wasting a lot of time!

8 years agoRemove more allocatoins in index querying
Alex Crichton [Fri, 2 Jun 2017 15:58:08 +0000 (08:58 -0700)]
Remove more allocatoins in index querying

Removing some allocations arounds the stored hashes by having nested hash maps
instead of tuple keys. Also remove an intermediate array when parsing
dependencies through a custom implementation of `Deserialize`. While this
doesn't make this code path blazingly fast it definitely knocks it down in the
profiles below other higher-value targets.

8 years agoCut down allocations in Display impls
Alex Crichton [Fri, 2 Jun 2017 14:21:50 +0000 (07:21 -0700)]
Cut down allocations in Display impls

Avoid unnecessary `String` allocations in hot paths that get run a lot for large
graphs.

8 years agoOptimize allocations in the registry index
Alex Crichton [Fri, 2 Jun 2017 13:57:43 +0000 (06:57 -0700)]
Optimize allocations in the registry index

Avoid some unnecessary clones, `to_vec`, etc. Not super optimizal but improves
the profile here regardless.

8 years agoOptimize the interface of `Registry`.
Alex Crichton [Fri, 2 Jun 2017 05:33:02 +0000 (22:33 -0700)]
Optimize the interface of `Registry`.

Previously all intermediate stages would create and return `Vec<Summary>`, but
this is a pretty costly operation once you start layering. Ideally we'd use an
iterator-based approach here but working with that in trait objects is
difficult, so this commit takes a closure-based approach to avoid all the
intermediate allocations that are thrown away.

8 years agoTry to not allocate when decoding registry json
Alex Crichton [Fri, 2 Jun 2017 14:00:17 +0000 (07:00 -0700)]
Try to not allocate when decoding registry json

There's a few keys we don't need owned versions of, so try using Serde's
zero-copy deserialization where we can.

8 years agoUse `Rc::make_mut` in `Dependency`
Alex Crichton [Fri, 2 Jun 2017 13:59:16 +0000 (06:59 -0700)]
Use `Rc::make_mut` in `Dependency`

Follow the same pattern with `Summary`

8 years agoMake `Summary::clone` cheap with an inner `Rc`
Alex Crichton [Fri, 2 Jun 2017 13:59:04 +0000 (06:59 -0700)]
Make `Summary::clone` cheap with an inner `Rc`

This already happens in a few other places in Cargo (e.g. `Dependency`) and
`Summary` cloning turned up high in the profile, so let's make it cheaper.

8 years agoOptimize resolution by removing allocations
Alex Crichton [Fri, 4 Nov 2016 00:18:48 +0000 (17:18 -0700)]
Optimize resolution by removing allocations

This commit is a relatively serious optimization pass of the resolution phase in
Cargo, targeted at removing as many allocations as possible from this phase.
Executed as an iterative loop this phase of Cargo can often be costly for large
graphs but it's run on every single build!

The main optimization here is to avoid cloning the context and/or pushing a
backtracking frame if there are no candidates left in the current list of
candidates. That optimizes a fast-path for crates with lock files (almost all of
them) and gets us to the point where cloning the context basically disappears
from all profiling.

8 years agoAuto merge of #4119 - fabricedesre:patch-1, r=alexcrichton
bors [Sat, 3 Jun 2017 17:54:43 +0000 (17:54 +0000)]
Auto merge of #4119 - fabricedesre:patch-1, r=alexcrichton

Fix typo in argument name.

8 years agoFix typo in argument name.
Fabrice Desré [Sat, 3 Jun 2017 01:51:09 +0000 (18:51 -0700)]
Fix typo in argument name.

8 years agoAuto merge of #4110 - alexcrichton:jobserver, r=matklad
bors [Fri, 2 Jun 2017 22:53:36 +0000 (22:53 +0000)]
Auto merge of #4110 - alexcrichton:jobserver, r=matklad

Add a GNU make jobserver implementation to Cargo

This commit adds a GNU make jobserver implementation to Cargo, both as a client
of existing jobservers and also a creator of new jobservers. The jobserver is
actually just an IPC semaphore which manifests itself as a pipe with N bytes
of tokens on Unix and a literal IPC semaphore on Windows. The rough protocol
is then if you want to run a job you read acquire the semaphore (read a byte on
Unix or wait on the semaphore on Windows) and then you release it when you're
done.

All the hairy details of the jobserver implementation are housed in the
`jobserver` crate on crates.io instead of Cargo. This should hopefully make it
much easier for the compiler to also share a jobserver implementation
eventually.

The main tricky bit here is that on Unix and Windows acquiring a jobserver token
will block the calling thread. We need to either way for a running job to exit
or to acquire a new token when we want to spawn a new job. To handle this the
current implementation spawns a helper thread that does the blocking and sends a
message back to Cargo when it receives a token. It's a little trickier with
shutting down this thread gracefully as well but more details can be found in
the `jobserver` crate.

Unfortunately crates are unlikely to see an immediate benefit of this once
implemented. Most crates are run with a manual `make -jN` and this overrides the
jobserver in the environment, creating a new jobserver in the sub-make. If the
`-jN` argument is removed, however, then `make` will share Cargo's jobserver and
properly limit parallelism.

Closes #1744

8 years agoAdd a GNU make jobserver implementation to Cargo
Alex Crichton [Tue, 30 May 2017 04:09:53 +0000 (21:09 -0700)]
Add a GNU make jobserver implementation to Cargo

This commit adds a GNU make jobserver implementation to Cargo, both as a client
of existing jobservers and also a creator of new jobservers. The jobserver is
actually just an IPC semaphore which manifests itself as a pipe with N bytes
of tokens on Unix and a literal IPC semaphore on Windows. The rough protocol
is then if you want to run a job you read acquire the semaphore (read a byte on
Unix or wait on the semaphore on Windows) and then you release it when you're
done.

All the hairy details of the jobserver implementation are housed in the
`jobserver` crate on crates.io instead of Cargo. This should hopefully make it
much easier for the compiler to also share a jobserver implementation
eventually.

The main tricky bit here is that on Unix and Windows acquiring a jobserver token
will block the calling thread. We need to either way for a running job to exit
or to acquire a new token when we want to spawn a new job. To handle this the
current implementation spawns a helper thread that does the blocking and sends a
message back to Cargo when it receives a token. It's a little trickier with
shutting down this thread gracefully as well but more details can be found in
the `jobserver` crate.

Unfortunately crates are unlikely to see an immediate benefit of this once
implemented. Most crates are run with a manual `make -jN` and this overrides the
jobserver in the environment, creating a new jobserver in the sub-make. If the
`-jN` argument is removed, however, then `make` will share Cargo's jobserver and
properly limit parallelism.

Closes #1744

8 years agoAuto merge of #4117 - brson:vs2017, r=alexcrichton
bors [Thu, 1 Jun 2017 22:20:28 +0000 (22:20 +0000)]
Auto merge of #4117 - brson:vs2017, r=alexcrichton

Update gcc crate for MSVC 2017

This is just a slightly more correct version of the gcc crate, but shouldn't have any practical changes.

8 years agoAuto merge of #4116 - alexcrichton:enotsupp, r=Mark-Simulacrum
bors [Thu, 1 Jun 2017 21:07:58 +0000 (21:07 +0000)]
Auto merge of #4116 - alexcrichton:enotsupp, r=Mark-Simulacrum

Ignore ENOTSUP in file locking on Linux too

Apparently there are some filesystems that return this!

Closes #4096

8 years agoUpdate gcc crate for MSVC 2017
Brian Anderson [Thu, 1 Jun 2017 21:01:17 +0000 (21:01 +0000)]
Update gcc crate for MSVC 2017

8 years agoIgnore ENOTSUP in file locking on Linux too
Alex Crichton [Thu, 1 Jun 2017 19:24:51 +0000 (12:24 -0700)]
Ignore ENOTSUP in file locking on Linux too

Apparently there are some filesystems that return this!

Closes #4096